Note This is exactly the same as if you coded PropertyPage.Changed = True.
Notifying the PropertyPage object that values have changed enables the Apply button on the Property Pages dialog box and causes the ApplyChanges event to occur when the following occurs:
The Apply button is pressed.
Users change pages.
The dialog box is closed.
The last routine you need to worry about and the second most important event in a PropertyPage object is the ApplyChanges event. In this event, you copy the changed property values back to the currently selected control. The following code is an example of this routine coded for your new control:
Private Sub PropertyPage_ApplyChanges()
SelectedControls(0).TableName = txtTableName.Text
SelectedControls(0).DisplayField = txtDisplayField.Text
End Sub
In this example, there is little chance for an error to occur in the ApplyChanges event. However, if your Property Page allows users to enter values that may be rejected by the Property Let (or Property Set) procedure in the control's code, you should use error trapping in the ApplyChanges event. The simplest scheme is to use On Error ResumeNext and test Err.Number after each property that may raise an error. When an error occurs, you should do the following:
Stop processing the ApplyChanges event.
Display an error message, so users understand what went wrong.
Set the focus to the property that caused the error.
Set the Changed property of the PropertyPage object to True.
Note Setting Changed to True re-enables the Apply button and prevents the Property Pages dialog box from being closed if users click OK.